<?php
/**
 * Created by IDEA.
 * User: dinesh
 * Date: Feb 25, 2012
 * Time: 7:24:00 PM
 * To change this template use File | Settings | File Templates.
 */
    abstract class BaseModel {


        abstract public function attributeNames();

        public function getAttributes($names=null)
        {
            $values=array();
            foreach($this->attributeNames() as $name)
                $values[$name]=$this->$name;

            if(is_array($names))
            {
                $values2=array();
                foreach($names as $name)
                    $values2[$name]=isset($values[$name]) ? $values[$name] : null;
                return $values2;
            }
            else
                return $values;
        }
    }

 
